﻿<UserControl x:Class="ISRecord.View.Views.BulkOutboxesView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:p="clr-namespace:ISRecord.View.Properties"
             mc:Ignorable="d" 
             Style="{StaticResource UserControlStyle}">
    <UserControl.Resources>
        <Style x:Key="SaveButtonStyle" TargetType="Button">
            <Style.Triggers>
                <Trigger Property="IsEnabled" Value="True">
                    <Setter Property="Content" Value="{StaticResource SaveImage}"/>
                </Trigger>
                <Trigger Property="IsEnabled" Value="False">
                    <Setter Property="Content" Value="{StaticResource SaveDisabledImage}"/>
                </Trigger>
            </Style.Triggers>
        </Style>
        <Style x:Key="TransButtonStyle" TargetType="Button">
            <Style.Triggers>
                <Trigger Property="IsEnabled" Value="True">
                    <Setter Property="Content" Value="{StaticResource TranspImage}"/>
                </Trigger>
                <Trigger Property="IsEnabled" Value="False">
                    <Setter Property="Content" Value="{StaticResource TranspDisabledImage}"/>
                </Trigger>
            </Style.Triggers>
        </Style>
    </UserControl.Resources>
    <Grid >
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="*" />
        </Grid.ColumnDefinitions>
        <ToolBar Grid.ColumnSpan="2" >
            <Button  Margin="3.5" Name="button1" Command="{Binding TransportDataCommand}" Style="{StaticResource TransButtonStyle}" />
            <Button  Margin="3.5" Name="button2" Command="{Binding SaveCommand}" Style="{StaticResource SaveButtonStyle}"/>

        </ToolBar>
        
        <TextBox Grid.Row="3" Height="Auto" HorizontalAlignment="Left" Name="textBox1" VerticalAlignment="Center" Width="350" Margin="3.5" Grid.Column="1" 
                 Text="{Binding Path=ExcelFilePath, Mode=OneWay}" IsEnabled="False" />
        <TextBox Height="Auto" HorizontalAlignment="Left" Margin="3.5" Name="textBox2" VerticalAlignment="Center" Width="200" Grid.Row="4" Grid.Column="1" 
                 Text="{Binding Path=ExcelSheetName, Mode=OneWay}" IsEnabled="False"/>
        <TextBox Height="Auto" HorizontalAlignment="Left" Margin="3.5" Name="textBox4" VerticalAlignment="Center" Width="500" Grid.Row="7" Grid.Column="1" 
                 Text="{Binding Path=PrefixBeforSubject, UpdateSourceTrigger=LostFocus}"/>
        <TextBox Height="Auto" HorizontalAlignment="Left" Margin="3.5" Name="textBox3" VerticalAlignment="Center" Width="500" Grid.Row="8" Grid.Column="1" 
                 Text="{Binding Path=PrefixAfterSubject, UpdateSourceTrigger=LostFocus}"/>
        
        <TextBlock Grid.Row="1" Height="Auto" HorizontalAlignment="Left" Margin="3.5" Name="textBlock1" 
                   Text="{x:Static p:Resources.ExcelFileRegionOption}" VerticalAlignment="Center" />
        <Rectangle Grid.ColumnSpan="2" Grid.Row="2" Height="1" Margin="3.5" Stroke="Black" VerticalAlignment="Top" />
        
        <TextBlock Height="Auto" HorizontalAlignment="Left" Margin="3.5" Name="textBlock3" 
                   Text="{x:Static p:Resources.ExcelFilePath}" VerticalAlignment="Center"  Grid.Row="3" />
        <Button Content="..." Grid.Column="1" Grid.Row="3" Width="33" Margin="355,4,0,5" Name="button3" 
                FontSize="25"  HorizontalContentAlignment="Center" VerticalContentAlignment="Center" 
                HorizontalAlignment="Left" Height="33" Command="{Binding OpenExcelFileCommand}"/>
        <TextBlock Height="Auto" HorizontalAlignment="Left" Margin="3.5" Name="textBlock4" 
                   Text="{x:Static p:Resources.ExcelSheetName}" VerticalAlignment="Center"  Grid.Row="4" />
        
        <TextBlock Height="Auto" HorizontalAlignment="Left" Margin="3.5" Name="textBlock5" 
                   Text="{x:Static p:Resources.ExcelDataProcessingOptions}" VerticalAlignment="Center" Grid.Row="5" Grid.ColumnSpan="2" />
        <Rectangle Grid.ColumnSpan="2" Grid.Row="6" Height="1" Margin="3.5" Stroke="Black" VerticalAlignment="Top" />
        
        <TextBlock Height="Auto" HorizontalAlignment="Left" Margin="3.5" Name="textBlock6" 
                   Text="{x:Static p:Resources.BeforSubjectPrefix}" VerticalAlignment="Center"  Grid.Row="7" />
        <TextBlock Height="Auto" HorizontalAlignment="Left" Margin="3.5" Name="textBlock7" 
                   Text="{x:Static p:Resources.AfterSubjectPrefix}" VerticalAlignment="Center" Grid.Row="8" />

        <DataGrid AutoGenerateColumns="False" Grid.ColumnSpan="2" Grid.Row="9" Height="Auto" Margin="3.5" VerticalAlignment="Top" 
                  ItemsSource="{Binding Path=Outboxes}"  Name="dataGrid1"  Width="Auto"
                  IsReadOnly="True">
            <DataGrid.Columns>
                <DataGridTextColumn Header="{x:Static p:Resources.OutboxNo}" Binding="{Binding Path=OutboxNo}" Width="Auto"/>
                <DataGridTextColumn Header="{x:Static p:Resources.OutboxDate}" Binding="{Binding Path=OutboxDate}" Width="Auto"/>
                <DataGridTextColumn Header="{x:Static p:Resources.OutboxSubject}" Binding="{Binding Path=Subject}" Width="*"/>
                <DataGridTextColumn Header="{x:Static p:Resources.OutboxGoingTo}" Binding="{Binding Path=GoingTo}" Width="*"/>
            </DataGrid.Columns>
        </DataGrid>
        
    </Grid>
</UserControl>
